package com.epam.tags;

import java.io.IOException;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.log4j.Logger;

import com.epam.entity.User;

public class UserTagHandler extends TagSupport {

	
	private static Logger LOG = Logger.getLogger(UserTagHandler.class);
	private static final long serialVersionUID = 1L;
	private User user;
	
	public int doStartTag() {
		
		JspWriter out = pageContext.getOut();
		
		
		try {    
			out.println("<tr>");
			out.println("<td>" + user.getId() + "</td>");
			out.println("<td>" + user.getLogin() + "</td>");
			out.println("<td>" + user.getRole() + "</td>");
			out.println("</tr>");
		} catch (IOException e) {
			LOG.error(e);
		}
		
		
		return SKIP_BODY;
	}
	
	
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

}
